$(document).ready(function(){
	$("#addline").click(function() {
		var $datatable = $("#datatable tr");
		var len=$datatable.length-3;
		var lenid=len-1;
		var newline = "<tr align='center' bgcolor='#FFFFFF' height='22'>"
			+"<td><input type='checkbox' id='selectedList' name='selectedList' value='"+lenid+"' class='np'></td>"
			+"<td><input type='text' class='tdinput' border='0' "+"name='customers["+lenid+"].customer_name' /></td>"
			+"<td ><input type='text' class='tdinput' "+"name='customers["+lenid+"].short_name' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].address' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].tel' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].email' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].postalcode' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].bank_name' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].bank_account' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].fax'/></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].linkman_name' /></td>"
			+"<td><input type='text' class='tdinput' "+"name='customers["+lenid+"].linkman_tel' /></td></tr>"
		//alert("newline:"+newline);
		var currentRow=$('#datatable:first tbody tr:eq('+len+')');
	    currentRow.after(newline);
	});
	$("#removeline").click(function() {
		var $datatable = $("#datatable tr");
		var len=$datatable.length-3;
		var currentRow=$('#datatable:first tbody tr:eq('+len+')');
		if(len>=3){
			currentRow.remove();
		}
	});
});

